<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>新品</title>
    <link rel="stylesheet" href="../css/aui.css">
    <link rel="stylesheet" href="../css/common.css">
    <script type="text/javascript" src="../script/api.js"></script>
    <script language="JavaScript" src="../script/vue.js"></script>
    <script language="JavaScript" src="../script/common.js"></script>
    <style>

        .sale-info {
            color: #9c9c9c;
            font-size: 0.5rem;
            display: inline-block;
        }

    </style>
</head>

<body>
    <div id="products-box" v-cloak>


      <div class="list-box aui-margin-t-10">
          <div class="row-two-item bgcolor-white" v-for="item in productlist" :key="item.id" @click="gopage(item)" tapmode>
              <div class="goodimg">  <img onload="fnLoadImage(this)" :data-url="item.cover_pic_url" src="../image/default.png" /></div>
              <div class="goodtitle">{{item.title}}  </div>
              <div class="aui-info" >
                  <div class="aui-info-item">
                    <span class="sale-price aui-margin-l-5" v-if="item.buy_how==0">￥{{item.pin_price/100}}</span>
                 <span class="sale-price aui-margin-l-5" v-else>￥{{item.directbuy_price/100}}</span>
                   </div>
                <div class="aui-margin-r-10" v-show="item.buy_how==0">已拼{{item.totalsalenum}}件</div>
              </div>
          </div>
      </div>
    </div>


    <script language="javascript">
        var pvm = new Vue({
            el: '#products-box',
            data: {
                page: 1,
                tid: 0,
                totalpage: 1,
                retback: true,
                productlist: [],
                typelogo: [],
                child_first_tid: 0,
                showmore: false,
            },
            methods: {
                gopage: function(item) {
                    $page.openwin('product_productinfo', './product/productinfo.html', {
                        id: item.id
                    });
                },


                getprdlist: function() {
                    if (pvm.page > pvm.totalpage || !pvm.retback) {
                        return;
                    }
                    pvm.retback = false;
                    $page.get_data('/api/product/getList', 'post', {
                        'page': pvm.page,
                        'tid': pvm.tid
                    }, function(ret) {
                        pvm.totalpage = ret.data.totalpage;
                        pvm.page = pvm.page + 1;
                        pvm.retback = true;
                        ret.data.list.forEach(function(el) {
                            pvm.productlist.push(el);
                        });
                    });
                }
            }
        });

        apiready = function() {
            $page.pullup(function(ret) {
                pvm.getprdlist();
            });
            $page.pullreload(function(){
              pvm.page=1;
                  pvm.getprdlist();
            });
pvm.getprdlist();
        }
    </script>
</body>

</html>
